/*
 * @Description: 系统配置(唯总管理员才有权限)
 * @Author: HuiSir<273250950@qq.com>
 * @Date: 2021-10-15 15:10:44
 * @LastEditTime: 2025-08-14 17:37:30
 */
import { useProjectConfig, rules2MockMethods } from "./_helpers";
const project = useProjectConfig();
const Prefix = "/dept/";

// 查询所有部门，用于部门管理
const getAllDept = {
  [project.responseFields.data]: [
    {
      id: "002",
      name: "行政部",
      status: "@integer(0, 1)",
      leader: "@cname",
      email: "@email",
      phone: /^(13[0-9]|14[57]|15[0-9]|18[0-35-9])\d{8}$/,
      delFlag: "@integer(0, 1)",
      remark: "",
      pid: null,
      createTime: "@datetime",
      updateTime: "@datetime",
      createUser: "@name",
      updateUser: "@name",
    },
    {
      id: "003",
      name: "人力资源部",
      status: "@integer(0, 1)",
      leader: "@cname",
      email: "@email",
      phone: /^(13[0-9]|14[57]|15[0-9]|18[0-35-9])\d{8}$/,
      delFlag: "@integer(0, 1)",
      remark: "",
      pid: null,
      createTime: "@datetime",
      updateTime: "@datetime",
      createUser: "@name",
      updateUser: "@name",
    },
    {
      id: "004",
      name: "销售部",
      status: "@integer(0, 1)",
      leader: "@cname",
      email: "@email",
      phone: /^(13[0-9]|14[57]|15[0-9]|18[0-35-9])\d{8}$/,
      delFlag: "@integer(0, 1)",
      remark: "",
      pid: null,
      createTime: "@datetime",
      updateTime: "@datetime",
      createUser: "@name",
      updateUser: "@name",
    },
    {
      id: "005",
      name: "技术部",
      status: "@integer(0, 1)",
      leader: "@cname",
      email: "@email",
      phone: /^(13[0-9]|14[57]|15[0-9]|18[0-35-9])\d{8}$/,
      delFlag: "@integer(0, 1)",
      remark: "",
      pid: null,
      createTime: "@datetime",
      updateTime: "@datetime",
      createUser: "@name",
      updateUser: "@name",
    },
    {
      id: "006",
      name: "财务部",
      status: "@integer(0, 1)",
      leader: "@cname",
      email: "@email",
      phone: /^(13[0-9]|14[57]|15[0-9]|18[0-35-9])\d{8}$/,
      delFlag: "@integer(0, 1)",
      remark: "",
      pid: null,
      createTime: "@datetime",
      updateTime: "@datetime",
      createUser: "@name",
      updateUser: "@name",
    },
    {
      id: "007",
      name: "网络部",
      status: "@integer(0, 1)",
      leader: "@cname",
      email: "@email",
      phone: /^(13[0-9]|14[57]|15[0-9]|18[0-35-9])\d{8}$/,
      delFlag: "@integer(0, 1)",
      remark: "",
      pid: "005",
      createTime: "@datetime",
      updateTime: "@datetime",
      createUser: "@name",
      updateUser: "@name",
    },
    {
      id: "008",
      name: "测试部",
      status: "@integer(0, 1)",
      leader: "@cname",
      email: "@email",
      phone: /^(13[0-9]|14[57]|15[0-9]|18[0-35-9])\d{8}$/,
      delFlag: "@integer(0, 1)",
      remark: "",
      pid: "005",
      createTime: "@datetime",
      updateTime: "@datetime",
      createUser: "@name",
      updateUser: "@name",
    },
    {
      id: "009",
      name: "开发部",
      status: "@integer(0, 1)",
      leader: "@cname",
      email: "@email",
      phone: /^(13[0-9]|14[57]|15[0-9]|18[0-35-9])\d{8}$/,
      delFlag: "@integer(0, 1)",
      remark: "",
      pid: "005",
      createTime: "@datetime",
      updateTime: "@datetime",
      createUser: "@name",
      updateUser: "@name",
    },
  ],
};

// 保存部门(新增、编辑)
const saveDept = { [project.responseFields.message]: "保存成功" };

// 删除部门
const delDept = { [project.responseFields.message]: "删除成功" };

const Rules: Record<string, unknown> = {
  getAllDept,
  saveDept,
  delDept,
};

export default rules2MockMethods(Rules, Prefix);
